@extends('back_end.layouts.default_info')

{{-- Web site Title --}}
@section('title')
{{{ Lang::get('general.back_end.role') }}} @if (isset($entry)){{{Lang::get('general.edit') }}}@else{{{Lang::get('general.create') }}}@endif :: @parent
@stop
@section('content_header')
{{{ Lang::get('general.back_end.role') }}} @if (isset($entry)){{{Lang::get('general.edit') }}}@else{{{Lang::get('general.create') }}}@endif
@stop
{{-- breadcrumb --}}
@section('breadcrumb')
<li><a href="#"><i class="fa fa-dashboard"></i> {{{ Lang::get('general.back_end.home') }}}</a></li>
<li class="active">{{{ Lang::get('general.back_end.role') }}} @if (isset($entry)){{{Lang::get('general.edit') }}}@else{{{Lang::get('general.create') }}}@endif</li>
@stop

{{-- Content --}}
@section('content')
<div class="box box-primary">

  {{-- Create Form --}}
    @if(isset($entry))
    {{ Form::open(array('action' => array('BackRoleController@doUpdate',$entry->id))) }}
    @else
    {{ Form::open(array('action' => 'BackRoleController@doCreate')) }}
    @endif
    <div class="box-body">
      <!-- Tabs -->
      <ul class="nav nav-tabs">
        <li class="active"><a href="#tab-general" data-toggle="tab">基本信息</a></li>
      </ul>
      <!-- ./ tabs -->


      <!-- Tabs Content -->
      <div class="tab-content">
        <!-- General tab -->
        <div class="tab-pane active" id="tab-general">
          <br/>
            {{ $tab_index = 1 ? '' : '' }}
            {{ $tab_index++ }}
            {{ Form::textGroup('name',  '关键字',   Input::old('name', isset($entry) ? $entry->name : ''),   $errors, $tab_index++, true) }}

            {{ Form::textGroup('display_name', '角色名', Input::old('display_name', isset($entry) ? $entry->display_name : ''),            $errors, $tab_index++, true) }}

            <!-- Permissions tab -->
            <div class="form-group row col-lg-12 col-md-12 col-xs-12">
                {{ Form::label('permissions', '权限选择') }}
                <div class="col-lg-12 col-md-12 col-xs-12">
                    @foreach ((isset($permissions) ? $permissions : Permission::all()) as $permission)
                    <label>
                        {{ Form::hidden('permissions['.$permission['id'].']', '0') }}
                        {{ Form::checkbox('permissions['.$permission['id'].']', '1', (isset($permission['checked']) && $permission['checked'])) }}
                        {{ $permission['display_name']}}
                        &nbsp;&nbsp;&nbsp;&nbsp;
                    </label>
                    @endforeach
                </div>
            </div>
            <!-- ./ permissions tab -->

        </div>
        <!-- ./ general tab -->

      </div>
      <!-- ./ tabs content -->

      {{ Form::submitButtonGroup('BackRoleController@getIndex', (Auth::user()->can('create_role')||Auth::user()->can('update_role')) , $tab_index) }}

      <!-- ./ form actions -->
    </div>
    {{ Form::close() }}
</div>
@stop


{{-- Scripts --}}
@section('scripts')
<script type="text/javascript">


</script>
@stop